﻿<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Dreamer Blog - 后台管理系统</title> 
    <!-- bootstrap 3.0.2 -->
    <link href="/resource/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <!-- Theme style -->
    <link href="/resource/css/style.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="/resource/js/jQueryMessage/css/message.skin.css" />
</head>

<body>
	<div class="row">
	    <div class="col-md-12">
	    	<h1 class="panel-heading">添加任务</h1>
	        <!--breadcrumbs start -->
	        <ul class="breadcrumb">
				<li><a href="/admin/dashboard/toIndex"><i class="fa fa-home"></i> 首页</a></li>
				<li class="active">添加任务</li>
			</ul>
	        <!--breadcrumbs end -->
	    </div>
	</div>
	<div class="row">
		<div class="col-lg-12">
			<section class="panel">
				<div class="panel-body">
					<form class="col s12" id="form1" th:action="@{/admin/task/add}" onsubmit="return validateForm();" method="post">
						<div class="form-group form-control-medium">
							<label for="taskName">任务名称：</label>
							<input id="taskName" name="taskName" type="text" class="form-control"/>
						</div>
						<div class="form-group form-control-large">
							<label for="clazzName">完整类路径：</label>
							<input id="clazzName" name="clazzName" type="text" class="form-control"/>
						</div>
						<div class="form-group form-control-medium">
							<label for="cronExpression">Cron表达式：</label>
							<input id="cronExpression" name="cronExpression" type="text" class="form-control"/>
						</div>
						<div class="form-group form-control-medium">
							<label for="remark">备注：</label>
							<textarea rows="5" name="remark" class="form-control"></textarea>
						</div>
						<div class="form-group form-control-medium">
							<label for="status">状态：</label>
							<input id="status-yes" name="status" type="radio" value="1" checked="checked"/> 有效
							<input id="status-no" name="status" type="radio" value="0"/> 无效
						</div>
						<div class="form-btn-group-left">
			            	<button type="submit" class="btn btn-info">保存</button>
			            </div>
					</form>
				</div>
			</section>
		</div>
	</div>
	<script src="/resource/js/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/resource/js/jQueryMessage/js/jquery.plugin.message.js"></script>
    <script type="text/javascript">
	   	/* 保存方法 */
	    function validateForm(){
	    	var taskName = $("#taskName").val();
	    	var clazzName = $("#clazzName").val();
	    	var cronExpression = $("#cronExpression").val();
	    	if(taskName == null || taskName==''){
	    		$("body").MessageBox({
					type: 'error',
					message:'任务名称不能为空',
					timeout:3000,
					callbak:null
				});
	    		return false;
	    	}
	    	if(clazzName == null || clazzName==''){
	    		$("body").MessageBox({
					type: 'error',
					message:'完整类路径不能为空',
					timeout:3000,
					callbak:null
				});
	    		return false;
	    	}
	    	if(cronExpression == null || cronExpression==''){
	    		$("body").MessageBox({
					type: 'error',
					message:'Cron表达式不能为空',
					timeout:3000,
					callbak:null
				});
	    		return false;
	    	}
	    	return true;
	    }
    </script>
</body>
</html>
